home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / ClarisCad.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  8.8 KB  |  212 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        ClarisCad.vu
  5. #
  6. #    Contains:    Quick look test script for Claris Cad version 2.0v3
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  19. #                                    launchTwitch().
  20. #     <1.0.5>     9/28/93    KTA        Added returnVal for ModifyDocument hook.
  21. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)()to InitGlobals(ScriptLevel)()
  22. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  23. #
  24. # ****************************************************************************
  25. #
  26.  
  27.  
  28.  
  29. ########################################################################
  30. #                            External libraries 
  31. #=======================================================================
  32. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib", "Da.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  33.  
  34.  
  35. #########################################################################
  36. ########               Application Specific Tasks
  37. #########################################################################
  38.  
  39. #########################################################################
  40. #                        InitAppGlobals()
  41. #========================================================================
  42. # Author:        KA
  43. # Description:    Sets up tools and fonts for Claris Cad.  This task
  44. #                must be called first.
  45. # Parameters:    None
  46. # Returns:        Nothing
  47. # Examples:        InitAppGlobals()
  48. #========================================================================
  49. # History:
  50. #
  51. ########################################################################
  52. task InitAppGlobals()
  53. begin
  54.     
  55.     logstr("setting up {global gApptitle}'s globals");            
  56.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick, kDragClick;
  57.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  58.     global kToolPaletteNum := 1; 
  59.     global kColorPaletteNum := 0;
  60.     global kPatternPaletteNum := 2;
  61.     global kGradientPaletteNum := 0;
  62.  
  63.     global gWindowInset := {67,35,20,35};        # Window inset
  64.     global gScreenInset := {0,20,0,0};            # Screen inset
  65.     global gVoidRect := {};                    # Rect not to draw in - coordinates should be RelativeToWindow
  66.     global gLineWeights := {'0.1 mm','0.35 mm','0.7 mm','0.016 inch','0.032 inch','0.064 inch'};
  67.     global gTextStr;
  68.     
  69.     global gPaletteList :=    {
  70.                             {                        #### Start Palette #1 - Tools
  71.                             {0, 20, 50, 223,0},        # Location of palette relative to the window
  72.                             kPalDocWind,            # Palette type
  73.                             {2,12},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  74.                             {24,17}                    # Offset between tools {h,v}
  75.                             },                        #### End Palette #1
  76.                             {
  77.                             {96, 20, 465, 35,0},    # Location of palette relative to the window
  78.                             kPalDocWind,            # Palette type
  79.                             {23,1},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  80.                             {17,0}                    # Offset between tools {h,v}
  81.                             }                        #### End Palette #2
  82.     };
  83.  
  84.     ### Claris CAD                                                                    {Flag, Pattern, Line, Color}
  85.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  86.     global SelectTool         :=     { 1,  1,         "Select",    kClick,     0,                {0}                };
  87.     global unknown                 :=     { 2,  1,         "Plus",        0,             0,                {0}                };
  88.     global CharTool         :=     { 3,  1,         "Char",        kDrag,         0,                {gTextStr,0,0,0}};
  89.     global unknown                 :=     { 4,  1,         "Line",        kDrag,         0,                {0}        };
  90.     global LineTool         :=     { 5,  1,         "Line",        kDrag,         0,                {1,0,1,0}        };
  91.     global unknown                 :=     { 6,  1,         "Line",        kDrag,         0,                {0}        };
  92.     global RectTool         :=     { 7,  1,        "Rectangle",kDrag,        0,                {1,1,1,0}        };
  93.     global unknown                 :=     { 8,  1,        "Rectangle",kDrag,        0,                {1,1,1,0}        };
  94.     global RndRectTool         :=     { 9,  1,         "RndRect",    kDrag,        0,                {1,1,1,0}        };
  95.     global unknown                 :=     { 10,  1,         "RndRect",    kDrag,        0,                {1,1,1,0}        };
  96.     global OvalTool         :=     { 11,  1,        "Oval",        kDrag,         0,                {1,1,1,0}        };
  97.     global unknown                 :=     { 12,  1,        "Oval",        kDrag,         0,                {1,1,1,0}        };
  98.     global ArcTool             :=     { 13,  1,         "Arc",        kDragClick,         0,                {2,1,1,0}        };
  99.     global unknown                 :=     { 14,  1,         "Arc",        kDrag,         0,                {2,1,1,0}        };
  100.     global FreeTool         :=     { 15,  1,         "Freehand",    kMultiDrag, 0,                {2,1,1,0}        };
  101.     global unknown                 :=     { 16,  1,         "Freehand",    kMultiDrag, 0,                {2,1,1,0}        };
  102.     global MultiLineTool     :=     { 17,  1,         "MultiLineTool",    kMultiClick,1,        {2,1,1,0}        };
  103.     global unknown                 :=     { 18,  1,         "Polygon",    kMultiClick,0,                {2,1,1,0}        };
  104.     global LengthTool         :=     { 19, 1,         "LengthTool",kDragClick,        0,                {2,1,1,0}        };
  105.     global unknown             :=     { 20, 1,         "",        0,         0,                {0}        };
  106.     global unknown             :=     { 21, 1,         "",        0,         0,                {0}        };
  107.     global unknown             :=     { 22, 1,         "",        0,         0,                {0}        };
  108.     global unknown             :=     { 23, 1,         "",        0,         0,                {0}        };
  109.     global unknown             :=     { 24, 1,         "",        0,         0,                {0}        };
  110.     global PenLine             :=     { '', {87,29,1}, "PenLine",        0,         0,                {0}                };
  111.     global ZoomOut             :=     { '', {5,-6,2}, "ZoomOut",        0,         0,                {0}                };
  112.     global ZoomIn             :=     { '', {17,-6,2}, "ZoomIn",        0,         0,                {0}                };
  113.  
  114.     # global Tool list
  115.     global gToolList:={    SelectTool, 
  116.                         CharTool,
  117.                         LineTool,
  118.                         RectTool,
  119.                         RndRectTool,
  120.                         OvalTool,
  121.                         ArcTool,
  122.                         FreeTool,
  123.                         MultiLineTool
  124.                         
  125. };
  126.  
  127.         ### font characteristic lists
  128.     global gFontSizeList := {'9','10','12','14','18', '24','36','48'};
  129.     global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow','Left','Right','Center','Justified','lowercase','UPPERCASE'};
  130.  
  131.         ### Name of the Plain (style) menu item  ####
  132.     global gPlainStyle := "Plain Text";            # Plain-Style menu item
  133.  
  134.         ### How to get to the next line
  135.     global gNextLineMethod := 1;            
  136.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  137.     
  138.         ### Does moving to the next line clear all font info
  139.     global gNextLineClearsFontSettings := 0;                        
  140.                         
  141. end;    #InitAppGlobals
  142.  
  143. #########################################################################
  144. #                            ClarisCadSetupDoText()
  145. #========================================================================
  146. # Author:        ML
  147. # Description:    Setup document for DoText()
  148. # Parameters:    None
  149. # Returns:        Nothing
  150. # Examples:        ClarisCadSetupDoText();
  151. # Assumptions:    None 
  152. # Applications:    Claris Cad
  153. #========================================================================
  154. # History:
  155. #
  156. #########################################################################
  157. task ClarisCadSetupDoText()
  158. begin
  159.     logstr("Setting up for DoText()");
  160.     Draw(global CharTool);
  161. end;
  162.  
  163. #########################################################################
  164. #                            ClarisCadModifyDocument()
  165. #========================================================================
  166. # Author:        ML
  167. # Description:    Modify Claris Cad Document
  168. # Parameters:    None
  169. # Returns:        Nothing
  170. # Examples:        ClarisCadModifyDocument();
  171. # Assumptions:    None 
  172. # Applications:    Claris Cad
  173. #========================================================================
  174. # History:
  175. #
  176. #########################################################################
  177. task ClarisCadModifyDocument()
  178. begin
  179.     return(Scrapbook(global kScrapTEXT));
  180. end;
  181.  
  182. ################################################################################
  183. ####################             Main script                    ####################
  184. ################################################################################
  185. script ClarisCad (ScriptLevel:= -1)
  186. begin
  187.     InitGlobals(ScriptLevel);            # initialize your general globals
  188.     InitDraw();
  189.     InitFonts();
  190.     global gApptitle := "Claris Cad";
  191.     global gAppVersion := '2';        # version of app you will be running
  192.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  193.     SuiteStart('ClarisCad.vu');                    # begin a new test suite
  194.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  195.     begin
  196.         global gSetLine := Task SetLineMenuItems;            # Requires VU 2.0
  197.         global gSetupDoText:= task ClarisCadSetupDoText;        # define app specific task
  198.         global gModifyDocument:= task ClarisCadModifyDocument; # define app specific task
  199.         InitAppGlobals();                                    # init app specific globals
  200.         (*
  201.         *)
  202.         DoSetUpApp(,,,,1,1);
  203.         DoDraw();
  204.         DoText();
  205.         DoWindow();
  206.         DoCloseApp(1);
  207.         LogStr("############################# LIMITATIONS: ############################");
  208.         LogStr("NOTE: Patterns may not be selected if Claris Cad not configured to show this palette");
  209.         LogStr("NOTE: Objects may not be drawn if the start point is not in the defined drawing space");
  210.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  211.     SuiteEnd();
  212. end;    #    script ClarisCad